<#assign contextPath=springMacroRequestContext.getContextPath() />
<#import "/public/frame/main.html" as frame />
<@frame.head "南航明珠商城-活动号管理">
</@frame.head>

<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 后台管理中心 <span class="c-gray en">&gt;</span> 监控管理 <span class="c-gray en">&gt;</span> 商品列表  <span class="c-gray en">&gt;</span>活动号管理<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
<form method="get" name="query_active_list_form"  id="query_active_list_form"  action="${contextPath}/ticket_coupon/query_active_list"  >    
   <input type="hidden" name="page" value="${pagination.pageNo}"  id="page" />  
   <input type="hidden" name="productId" value="${(product.id?c)!}"  id="prod_id" />
</form>
    <table class="table table-border table-bordered table-bg">
        <thead>
          <tr class="text-c">
           <th>商品编号</th>
		   <th>商品名称</th>
		   <th>下架日期</th>
		   <th width="180" >操作</th>
          </tr>
        </thead>
        <tbody>
           <tr class="text-c">
             <td>${(product.id?c)!}</td>
             <td>${product.baseInfo.name}</td>
             <td>${(product.downDate?string("yyyy-MM-dd  HH:mm:ss"))!}</td>
             <td>
             <input  style="display:none;" id="expiryTime" type="text" class="input-text Wdate" onfocus="WdatePicker({minDate:'%y-%M-%d',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly: true ,onpicked:function(){setproductdate();}});">
             <button  class="btn btn-success radius"  type="button" onclick="show_WdatePicker(this);" >设置下架日期</button></td>
           </tr>
        </tbody>
    </table>
    
    <div class="cl pd-5 bg-1 bk-gray mt-20"> 
    <span class="r">共有数据：<strong>${pagination.totalCount}</strong> 条</span> 
    </div>
    <table id="coupon_table" class="table table-border table-bordered table-bg">
        <thead>
           <tr class="text-c">
				<th width="130px">活动号</th>
				<th>面值</th>
				<th width="80px">活动月份</th>
				<th>有效期至</th>
				<th>过期时间</th>
				<th>创建时间</th>
				<th>数量</th>
				<th>状态</th>
				<th width="60px">操作</th>
		   </tr>
        </thead>
        <tbody>
          <#if pagination.list?? && (pagination.list?size &gt; 0)>
             <#list pagination.list as coupon> 
                    <tr class="text-c">
                       <td>${coupon.activeNo}</td>
                       <td>${coupon.ticketMileage}</td>
                       <td>${(coupon.activeMonth?string("yyyy-MM"))!}</td>
                       <td>${(coupon.expiryDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
                       <td>${(coupon.endDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
                       <td>${(coupon.createDate?string("yyyy-MM-dd HH:mm:ss"))!}</td>
                       <td>${coupon.num}</td>
                       <td>
                       <#if coupon.state==0><span class="label radius">同步失败</span>
                       <#elseif  coupon.state==1><span class="label label-success radius">同步成功</span>
                       <#elseif  coupon.state==2><span class="label radius">已过期</span>
                       <#elseif  coupon.state==3><span class="label radius">已作废</span>
                       <#elseif  coupon.state==4><span class="label radius">未同步</span>
                       </#if>
                       </td>
                       <td>
                       <#if coupon.state==0 || coupon.state==4 >
                         <a  href="javascript:void(0);"  onclick="synchroStock('${coupon.activeId}')">同步</a>
                       <#elseif  coupon.state==1>
                         <a  href="javascript:void(0);"  onclick="synchroStock('${coupon.activeId}')">同步</a>
						 <a  href="javascript:void(0);"  onclick="invalidate('${coupon.activeId}')">作废</a>
                       </#if>
                       </td>
                    </tr>
             </#list>
          <#else>
             <tr><td colspan="9" align="center">暂无数据!</td></tr>   
          </#if>
        </tbody>
    </table>
    <div id="operate" style="margin-top: 20px;">
	  <#if product.statusInfo.status==2>
		<input type="button" id="addActive" class="btn btn-success radius" value="添加活动号" name="add" onclick="addActive()" class="form_btn"/>
	  </#if>
	</div>
    <div id="div_page" style="padding-top: 10px;float: right"></div>
</div>
<@frame.end "default">
</@frame.end>
</html>
<script type="text/javascript" src="${contextPath}/resources/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/laypage/laypage.js"></script>
<script type="text/javascript" src="${contextPath}/resources/js/ticket_coupon/query_active_list.js"></script>
<script type="text/javascript">
var path="${contextPath}";
laypage({
    cont: 'div_page',//容器。值支持id名、原生dom对象，jquery对象。
    pages: ${pagination.totalPage},//通过后台拿到的总页数
    curr:  ${pagination.pageNo} || 1, //当前页
	skip: true, //是否开启跳页
	first: 1, //将首页显示为数字1,。若不显示，设置false即可
	last: ${pagination.totalPage}, //将尾页显示为总页数。若不显示，设置false即可
    jump: function(obj , first){//触发分页后的回调
        if(!first){ //点击跳页触发函数;当前页为obj.curr
            $("#page").val(obj.curr);
             $("#query_active_list_form").submit();
        }
    }
})  

</script>